/*
 * Copyright 2025 The JA-SIG Collaborative. All rights reserved.
 * distributed with this file and available online at
 */
package com.lap.auth.application.dict.assembler;

import com.lap.auth.application.dict.command.BatchCreateDictCmd;
import com.lap.auth.application.dict.command.CreateDictCmd;
import com.lap.auth.application.dict.dto.DictDto;
import com.lap.auth.domain.dict.Dict;
import java.util.List;
import org.mapstruct.Mapper;

@Mapper(componentModel = "spring")
public interface DictAssembler {

  Dict toDomain(String dictTypeCode, CreateDictCmd cmd);

  default List<Dict> toDomains(BatchCreateDictCmd cmd) {
    return cmd.getList().stream().map(item -> toDomain(cmd.getDictTypeCode(), item)).toList();
  }

  DictDto toDto(Dict dict);

  List<DictDto> toDtoList(List<Dict> list);
}
